翻訳と辞書
Words near each other
・ American Film Institute Awards 2014
・ American Film Manufacturing Company
・ American Film Market
・ American Film Program
・ American Film Renaissance
・ American Film Theatre
・ American Finance Association
・ American Financial Group
・ American Financial Services Association
・ American Fine Arts Society
・ American First National Bank Holdings
・ American Five
・ American Flag (disambiguation)
・ American Flag (horse)
・ American flag rugby
American flag sort
・ American Flag, Arizona
・ American Flagg!
・ American flamingo
・ American Fletcher National Bank
・ American Flower-class corvettes
・ American Flyer
・ American Flyer (band)
・ American Flyer (disambiguation)
・ American Flyers
・ American Flyers (flight school)
・ American Flyers Airline
・ American Flyers Flight 280
・ American Folk Art Museum
・ American Folk Blues Festival


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

American flag sort : ウィキペディア英語版
American flag sort
An American flag sort is an efficient, in-place variant of radix sort that distributes items into hundreds of buckets. Non-comparative sorting algorithms such as radix sort and American flag sort are typically used to sort large objects such as strings, for which comparison is not a unit-time operation.〔

American flag sort iterates through the bits of the objects, considering several bits of each object at a time. For each set of bits, American flag sort makes two passes through the array of objects: first to count the number of objects that will fall in each bin, and second to place each object in its bucket. This works especially well when sorting a byte at a time, using 256 buckets. With some optimizations, it is twice as fast as quicksort for large sets of strings.〔
The name comes by analogy with the Dutch national flag problem in the last step: efficiently partition the array into many "stripes".
== Algorithm ==
Sorting algorithms in general sort a list of objects according to some ordering scheme. In contrast to comparison-based sorting algorithms, such as quicksort, American flag sort can only sort integers (or objects that can be interpreted as integers). In-place sorting algorithms, including American flag sort, run without allocating a significant amount of memory beyond that used by the original array. This is a significant advantage, both in memory savings and in time saved copying the array.
American flag sort works by successively dividing a list of objects into buckets based on the first digit of their base-N representation (the base used is referred to as the ''radix''). When N is 2, each object can be swapped into the correct bucket by using the Dutch national flag algorithm. When N is larger, however, objects cannot be immediately swapped into place, because it is unknown where each bucket should begin and end. American flag sort gets around this problem by making two passes through the array. The first pass counts the number of objects that belong in each of the N buckets. The beginning and end of each bucket in the original array is then computed as the sum of sizes of preceding buckets. The second pass swaps each object into place.
American flag sort is most efficient with a radix that is a power of 2, because bit-shifting operations can be used instead of expensive logarithms to compute the value of each digit. When sorting strings using 8- or 7-bit encodings such as ASCII, it is typical to use a radix of 256, which amounts to sorting character-by-character.〔

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「American flag sort」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.